package com.example.javapracticaltraining.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.javapracticaltraining.entity.BaseData;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalTime;

/**
 * 医护人员排班表
 * @TableName staff_schedule
 */
@TableName(value ="staff_schedule")
@Data
public class StaffSchedule implements BaseData {
    /**
     * 排班ID
     */
    @TableId(value = "schedule_id", type = IdType.AUTO)
    private Integer scheduleId;

    /**
     * 医护人员ID
     */
    @TableField(value = "staff_id")
    private Integer staffId;

    /**
     * 排班日期
     */
    @TableField(value = "schedule_date")
    private LocalDate scheduleDate;

    /**
     * 开始时间
     */
    @TableField(value = "start_time")
    private LocalTime startTime;

    /**
     * 结束时间
     */
    @TableField(value = "end_time")
    private LocalTime endTime;

    /**
     * 班次类型（早班、中班、晚班等）
     */
    @TableField(value = "shift_type")
    private String shiftType;

    /**
     * 工作区域
     */
    @TableField(value = "work_area")
    private String workArea;

    /**
     * 状态（0-已取消，1-正常）
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 备注
     */
    @TableField(value = "remarks")
    private String remarks;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        StaffSchedule other = (StaffSchedule) that;
        return (this.getScheduleId() == null ? other.getScheduleId() == null : this.getScheduleId().equals(other.getScheduleId()))
            && (this.getStaffId() == null ? other.getStaffId() == null : this.getStaffId().equals(other.getStaffId()))
            && (this.getScheduleDate() == null ? other.getScheduleDate() == null : this.getScheduleDate().equals(other.getScheduleDate()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getShiftType() == null ? other.getShiftType() == null : this.getShiftType().equals(other.getShiftType()))
            && (this.getWorkArea() == null ? other.getWorkArea() == null : this.getWorkArea().equals(other.getWorkArea()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getScheduleId() == null) ? 0 : getScheduleId().hashCode());
        result = prime * result + ((getStaffId() == null) ? 0 : getStaffId().hashCode());
        result = prime * result + ((getScheduleDate() == null) ? 0 : getScheduleDate().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getShiftType() == null) ? 0 : getShiftType().hashCode());
        result = prime * result + ((getWorkArea() == null) ? 0 : getWorkArea().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", scheduleId=").append(scheduleId);
        sb.append(", staffId=").append(staffId);
        sb.append(", scheduleDate=").append(scheduleDate);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", shiftType=").append(shiftType);
        sb.append(", workArea=").append(workArea);
        sb.append(", status=").append(status);
        sb.append(", remarks=").append(remarks);
        sb.append("]");
        return sb.toString();
    }
}